﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using KPIS.GERP.GBMS.MODEL;

namespace KPIS.GERP.GBMS.BLL
{
    public interface IProject
    {
        DataTable GetDataProjectByYear(int Year, string HeaderID);
        DataTable GetDataProjectBySequence(string seq);
        DataTable GetDataProjectBySequenceForGridIn(string seq);
        DataTable GetDataProjectExpGrpBySequenceForGridIn(string seq);
        DataTable GetDataProjectAndSource(string HeaderID, string StrategyID);
        DataTable GetDataProjectAndSourceGroup(string HeaderID, string StrategyID);
        DataTable GetDataProjectOption(string bgm_prj_seq, string bgm_option_type_seq);
        DataTable GetDataProjectOptionBySequence(string seq);
        DataTable GetDataProjectKPI(string bgm_prj_seq);
        DataTable GetDataProjectKPIBySequence(string bgm_prj_kpi_seq);
        DataTable GetDataProjectActivityPlan(string bgm_prj_seq);
        DataTable GetDataProjectActivityPlanBySequence(string bgm_prj_act_plan_seq);
        DataTable GetDataProjectActivityPlanTarget(string bgm_prj_act_plan_seq);
        DataTable GetDataProjectExpense(string bgm_prj_seq, string source, string bgm_exp_grp_seq);
        DataTable GetDataProjectExpenseOnlyExp(string bgm_proj_seq, string source, string bgm_exp_grp_seq);
        DataTable GetDataProjectReportExpense(string bgm_prj_seq, string source);
        DataTable GetDataProjectExpenseBySequence(string bgm_prj_exp_seq);
        DataTable GetDataProjectExpenseGroup(string bgm_prj_seq, string bgm_source_seq);
        DataTable GetDataProjectExpensePlan(string bgm_prj_seq, string bgm_source_seq);
        DataTable GetDataProjectExpensePlanBySequence(string bgm_prj_exp_plan_seq);
        DataTable ListProjectExpenseResource(string bgm_req_seq, string bgm_exp_seq, string bgm_source_seq);

        int InsertProject(string bgm_rec_header_seq, string bgm_year, DateTime bgm_prj_date, string bgm_strat_list_seq, string job_site_seq, string prj_type_seq, string bgm_prj_manager, string bgm_prj_scope, string bgm_prj_code, string bgm_prj_name, string bgm_prj_descr, string bgm_prj_reason, string bgm_prj_object, string bgm_prj_plan, string bgm_prj_target, string bgm_prj_remark, string CreatedBy, string job_site_seq_main);
        int InsertProject(string bgm_year, DateTime bgm_req_date, string bgm_req_name, string bgm_strat_list_seq, string job_site_seq, string prj_type_seq, string bgm_req_scope, string bgm_req_reason, string bgm_req_object, string bgm_req_plan, string bgm_req_target, string bgm_req_aim, string bgm_req_profit, string bgm_req_remark, string date_start, string date_end, string CreatedBy, string job_site_seq_main);
        void InsertProjectCustoms(string bgm_prj_seq, string prj_ctrl_seq, string descr);
        void InsertProjectOption(string bgm_prj_seq, string descr, Nullable<Double> weight, string bgm_option_seq, string created_by);
        void InsertProjectKPI(string bgm_req_kpi_name, string bgm_req_kpi_descr, string unit, string bgm_req_kpi_weight, string bgm_req_seq, string bgm_kpi_type_seq, string score_1, string score_2, string score_3, string score_4, string score_5, string target_type
                , string target_m1, string target_m2, string target_m3, string target_m4, string target_m5, string target_m6, string target_m7, string target_m8, string target_m9, string target_m10, string target_m11, string target_m12
                , string mtef_1, string mtef_2, string mtef_3, string created_by);
        int InsertProjectActivityPlan(string bgm_prj_seq, string descr, int act_month1, int act_month2, int act_month3, int act_month4, int act_month5, int act_month6, int act_month7, int act_month8, int act_month9, int act_month10, int act_month11, int act_month12, string created_by);
        void InsertProjectActivityPlanTarget(string bgm_prj_act_plan_seq, string target, string start_month, string end_month, string created_by);
        void InsertProjectExpense(string bgm_prj_seq, string bgm_source_seq, string bgm_exp_seq, string total_amount, string descr, Nullable<int> icm_res_item_seq, Nullable<int> unit_qty, Nullable<decimal> unit_price, Nullable<decimal> mtef1, Nullable<decimal> mtef2, Nullable<decimal> mtef3, string created_by);
        void InsertProjectExpensePlan(string bgm_prj_exp_seq, string amount_month1, string amount_month2, string amount_month3, string amount_month4, string amount_month5, string amount_month6, string amount_month7, string amount_month8, string amount_month9, string amount_month10, string amount_month11, string amount_month12, string created_by);
        void UpdateProject(string bgm_proj_seq, DateTime bgm_proj_date, string bgm_proj_code, string bgm_proj_name
            , string bgm_proj_descr, string job_site_seq_main, string bgm_proj_manager, string bgm_proj_scope
            , string bgm_proj_reason, string bgm_proj_object, string bgm_proj_target, string bgm_proj_plan, string bgm_proj_aim, string bgm_proj_profit
            , string bgm_proj_remark, string bgm_strat_list_seq, string prj_type_seq, DateTime date_start, DateTime date_end
            , string gfmis_code, string UpdatedBy);
        void UpdateProjectOption(string Sequence, string descr, Nullable<Double> weight, string bgm_option_seq, string UpdateBy);
        void UpdateProjectKPI(string Sequence, string bgm_req_kpi_name, string bgm_req_kpi_descr, string unit, string bgm_req_kpi_weight, string bgm_kpi_type_seq, string score_1, string score_2, string score_3, string score_4, string score_5, string target_type
            , string target_m1, string target_m2, string target_m3, string target_m4, string target_m5, string target_m6, string target_m7, string target_m8, string target_m9, string target_m10, string target_m11, string target_m12
            , string mtef_1, string mtef_2, string mtef_3, string UpdateBy);
        void UpdateProjectActivityPlan(string Sequence, string descr, int act_month1, int act_month2, int act_month3, int act_month4, int act_month5, int act_month6, int act_month7, int act_month8, int act_month9, int act_month10, int act_month11, int act_month12, string UpdateBy);
        void UpdateProjectActivityPlanTarget(string Sequence, string target, string start_month, string end_month, string UpdateBy);
        void UpdateProjectExpense(string Sequence, string bgm_proj_seq, string bgm_source_seq, string bgm_exp_seq, string total_amount, string descr, Nullable<int> icm_res_item_seq, Nullable<int> unit_qty, Nullable<decimal> unit_price, Nullable<decimal> mtef1, Nullable<decimal> mtef2, Nullable<decimal> mtef3, string UpdateBy);
        /// <summary>
        /// Use for update total_amount field of table bgm_request/bgm_project
        /// </summary>
        /// <param name="Sequence"></param>
        /// <param name="Name"></param>
        /// <param name="used_amount"></param>
        /// <param name="cal_amount"></param>
        /// <param name="rpt_type">
        /// 1=จัดสรร
        /// 2=โอนไป
        /// 3=รับโอน
        /// 4=จองเงิน
        /// 5=กันเงิน
        /// 6=ตั้งหนี้
        /// 7=เบิกจ่าย
        /// 8=คืนเงิน
        /// </param>
        /// <param name="UpdateBy"></param>
        void UpdateTotalAmountProjectExpense(string Sequence, string Name, string used_amount, string cal_amount, string rpt_type, string UpdateBy);
        void UpdateProjectExpensePlan(string Sequence, string amount_month1, string amount_month2, string amount_month3, string amount_month4, string amount_month5, string amount_month6, string amount_month7, string amount_month8, string amount_month9, string amount_month10, string amount_month11, string amount_month12, string UpdateBy);
        void UpdateProjectCustoms(string Sequence, string descr);
        void DeleteProject(string Seq, string UpdateBy);
        void DeleteProjectOption(string Seq);
        void DeleteProjectKPI(string Seq);
        void DeleteProjectActivityPlan(string Seq);
        void DeleteProjectActivityPlanTarget(string Seq);
        void DeleteProjectExpense(string Seq);
        void DeleteProjectOptionFromProjSeq(string BgmProjSeq, string BgmOptionTypeSeq);

        void InsertProjectManager(string bgm_prj_seq, string emp_seq);
        void DeleteProjectManager(string bgm_prj_seq);
        DataTable GetDataProjectManager(string bgm_prj_seq);
        bool chkDubProjectOption(string bgm_prj_seq, string bgm_option_seq);
        DataTable GetDataProjectControlByJobSite(string job_site_seq, string HeaderID);
        DataTable GetDataProjectByYearAndJobSite(string year, string job_site_seq, string emp_seq, string status);
        DataTable GetDataProjectByYearAndJobSiteAndSubAct(string year, string job_site_seq, string sub_act, string status);
        DataTable GetDataProjectControlBySequenceForGridIn(string seq, string job_site_seq);

        DataTable ListProjectExpenseGrid(string ProjectSeq, string Source, string ExpenseGroup, bool ShowAllExpense);
        //DataTable ListProjectExpenseGridForEdit(string proj_seq, string source, string exp_grp, bool show_all_exp);
        DataTable ListProjectOptionGrid(string ProjectSeq, string OptionType);
        DataTable ListProjectOptionRepeater(string req_seq, string upper_bgm_option_seq, string optionType);
        DataTable ListProjectOptionTreeView(string req_seq, string optionType);
        DataTable ListProjectOption(string bgm_proj_seq, string optionType);

        void ApproveProject(string ProjectSeq);
        void ApproveProject(string ProjectSeq, string status);

        DataTable GetReport_01(string year);
        DataTable GetReport_01_01(string year);
        DataTable GetReport_01_02(string year);

        DataTable GetReport_02(string year);
        DataTable GetReport_04(string year);
        DataTable GetReport_05(string year, string optionType);
        DataTable GetReport_06(string year, string TypeParent, string Type);
    }
}
